//
//  BRSUserTypeViewController.m
//  Pint
//
//  Created by xiect on 13-10-24.
//  Copyright (c) 2013年 brains. All rights reserved.
//

#import "BRSUserTypeViewController.h"
#import "BRSLoginViewController.h"

@interface BRSUserTypeViewController ()

@property(nonatomic,strong,readwrite) UIButton* btnNewUser;    // 新規
@property(nonatomic,strong,readwrite) UIButton* btnExistUser;  // 既存
@property(nonatomic,strong,readwrite) UIButton* btnBack;       // 戻る
@end

@implementation BRSUserTypeViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

-(void) loadView{
    [super loadView];
    CGFloat oriY = (kSCREEN_HEIGHT / 2) - (kDEFAULT_BTN_HEIGHT * 2) - kDEFAULT_BTN_PADDING - kDEFAULT_BTN_HEIGHT;
    NSLog(@"oriY=====>%f",oriY);
    self.btnNewUser = [[UIButton alloc] initWithFrame:CGRectMake(0, oriY, kDEFAULT_BTN_WIDTH, kDEFAULT_BTN_HEIGHT)];
    [self.btnNewUser setTitle:kBTN_NEW_USER forState:UIControlStateNormal] ;
    self.btnNewUser.backgroundColor = [UIColor brownColor];
    
    oriY = oriY + kDEFAULT_BTN_PADDING + kDEFAULT_BTN_HEIGHT;
    self.btnExistUser = [[UIButton alloc] initWithFrame:CGRectMake(0, oriY, kDEFAULT_BTN_WIDTH, kDEFAULT_BTN_HEIGHT)];
    [self.btnExistUser setTitle:kBTN_EXIST_USER forState:UIControlStateNormal] ;
    self.btnExistUser.backgroundColor = [UIColor greenColor];
    
    oriY = oriY + kDEFAULT_BTN_PADDING + kDEFAULT_BTN_HEIGHT;
    self.btnBack      = [[UIButton alloc] initWithFrame:CGRectMake(0,oriY, kDEFAULT_BTN_WIDTH, kDEFAULT_BTN_HEIGHT)];
    [self.btnBack setTitle:kBTN_BACK forState:UIControlStateNormal] ;
    self.btnBack.backgroundColor = [UIColor yellowColor];
    
    [self.view addSubview:self.btnNewUser];
    [self.view addSubview:self.btnExistUser];
    [self.view addSubview:self.btnBack];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    UILabel*title = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
    title.text = kTITLE_USER_TYPE;
    title.textAlignment = NSTextAlignmentCenter;
    self.navigationItem.titleView = title;
    
    // button events
    [self.btnNewUser  addTarget:self action:@selector(btnNewUserClicked:) forControlEvents:UIControlEventTouchUpInside];
    [self.btnExistUser  addTarget:self action:@selector(btnExistUserClicked:) forControlEvents:UIControlEventTouchUpInside];
    [self.btnBack  addTarget:self action:@selector(btnBackClicked:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark -
#pragma mark button event
-(void)btnNewUserClicked:(id)sender {

}

-(void)btnExistUserClicked:(id)sender {
    UIViewController * controller = [[BRSLoginViewController alloc] init];
    [self.navigationController pushViewController:controller animated:YES];
}

-(void)btnBackClicked:(id)sender {
    
}

@end
